﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using PrinterBudi.Persistence;

namespace PrinterBudi.Web.Controllers
{
    public class RegisterController : Controller
    {
        //
        // GET: /Register/
        [HttpPost]
        public ActionResult Index(string username, string password, string password2, string completeName, string address)
        {
            RedirectResult rr = null;
            if (username.Equals(""))
            {
                rr = Redirect("/Home/Register?retry=1");
            }
            else if (!password.Equals(password2))
            {
                rr = Redirect("/Home/Register?retry=2");
            }
            else
            {
                PBUserModel.Create(username, password, completeName, address, 0);
                rr = Redirect("/Home");
            }
            return rr;
        }

    }
}
